import java.util.Scanner;

public class Test5 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        long[]array = new long[t];
        for (int i = 0; i < t; i++) {
            array[i] = scanner.nextInt();
        }
        int count = 0;
        if(t <= 2){
            System.out.println(1);
            return;
        }
        int i = 0;
        while (i < t-1) {
            while (i+1 < t && array[i] == array[i+1]){
                i++;
            }
            if(i+1 < t && array[i] < array[i+1]){
                while (i+1 < t && array[i] <= array[i+1]){
                    i++;
                }
            }else {
                while (i+1 < t && array[i] >= array[i+1]){
                    i++;
                }
            }
            i++;
            //主要就是这个
            if(i == t-1){
                count++;
            }
            count++;

        }
        System.out.println(count);
    }
}
